<%--
  Created by IntelliJ IDEA.
  User: 10379
  Date: 2020/9/28
  Time: 16:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>Typography</title>

    <link href="${pageContext.request.contextPath}/static/css/style.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/style-responsive.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="${pageContext.request.contextPath}/static/js/html5shiv.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="sticky-header" style="background-color:#E4E7EA">

<section>
    <!-- main content start-->
        <!--body wrapper start-->
        <section class="wrapper">
            <!-- page start-->

            <div class="row">
                <div class="col-md-8">
                    <section class="panel">
                        <header class="panel-heading">
                           课程名： <input type="text" id="subjectName" readonly  unselectable="on"  style="border:none;"/>
                            <span class="tools pull-right">
                            <a class="fa fa-chevron-down" href="javascript:;"></a>

                            <a class="fa fa-times" href="javascript:;"></a>
                         </span>
                        </header>
                        <div class="panel-body">
                            <div class="row">
                                <div class = col-md-12>
                                    <p><h3>课程简介：</h3></p>
                                </div>
                                <hr>
                                <div class="col-md-12" id="javatext">

                                </div>
                                <%--<div class="col-md-2">
                                    <h3>Texts</h3>
                                    <p class="muted">
                                        Donec ullamcorper nulla non metus auctor fringilla.
                                    </p>
                                    <p class="text-warning">
                                        Etiam porta sem malesuada magna mollis euismod.
                                    </p>
                                </div>--%>

                            </div>
                            <hr>
                        </div>
                    </section>
                </div>
                <div class="col-md-4">
                    <div class="row">
                        <div class="col-md-12">
                            <section class="panel">
                                <header class="panel-heading">
                                    <span class="text-muted">包含班级：</span>
                                    <span class="tools pull-right">
                                    <a class="fa fa-chevron-down" href="javascript:;"></a>

                                    <a class="fa fa-times" href="javascript:;"></a>
                                 </span>
                                </header>
                                <div class="panel-body">
                                    <ul id="classes">

                                    </ul>
                                </div>
                            </section>

                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12">
                            <section class="panel">
                                <header class="panel-heading">
                                    <span class="text-muted">公告</span>
                                    <span class="tools pull-right">
                            <a class="fa fa-chevron-down" href="javascript:;"></a>

                            <a class="fa fa-times" href="javascript:;"></a>
                         </span>
                                </header>
                                <div class="panel-body">
                                    <ol>
                                        <h4>
                                        <li>
                                            国庆放假安排
                                        </li>
                                            <hr>
                                        <li>
                                            中秋放假安排
                                        </li>
                                            <hr>
                                        <li>
                                            周末放假安排
                                        </li>
                                            <hr>
                                        <li>
                                            团建安排
                                        </li>
                                       <%-- <li>
                                            Nulla volutpat aliquam velit
                                        </li>
                                        <li>
                                            Faucibus porta lacus fringilla vel
                                        </li>
                                        <li>
                                            Aenean sit amet erat nunc
                                        </li>
                                        <li>
                                            Eget porttitor lorem
                                        </li>--%>
                                        </h4>
                                    </ol>
                                </div>
                            </section>
                        </div>
                    </div>
                </div>
            </div>
            <!-- page end-->
        </section>
        <!--body wrapper end-->
</section>

<!-- Placed js at the end of the document so the pages load faster -->
<script src="${pageContext.request.contextPath}/static/js/jquery-1.10.2.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/jquery-migrate-1.2.1.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/modernizr.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/jquery.nicescroll.js"></script>

<!--common scripts for all pages-->
<script src="${pageContext.request.contextPath}/static/js/scripts.js"></script>
<script>
    $(function () {
        subjectId = ${subjectId};
        getNowSubject(subjectId);
    })
    function getNowSubject(subjectId) {
        $.ajax({
            url: "${pageContext.request.contextPath}/subject/getOneSubject",
            type: 'get',
            data: {"subjectId": subjectId},//传递课程id
            dataType: 'json',
            success: function (result) {
                if (result.code == 0) {
                    $("#subjectName").val(result.subject.name);
                    var html = '';
                        html+="<p><h4>";
                        html+= result.subject.javatext;
                        html+= "</h4></p>";
                        html+="<hr>";
                        html+="<h4>华清远见教育集团，一家专注IT就业培训的教育机构，成立于2004年。" +
                        "伴随着公司的高速成长，华清远见先后在北京、上海、深圳、武汉、成都、南京、西安、广州、沈阳、济南、重庆、长沙等地" +
                        "成立分公司，通过全国范围内的培训业务平台，每年有近万名技术人员受益于华清远见组织的技术研讨会、短期" +
                        "及长期的培训课程、以及企业内训等。企业文化：专业始于专注，卓识源于远见。</h4>";
                    $("#javatext").html(html);
                    getClasses(result.subject.subjectId);
                }
            },
            error: function (err) {
                alert("获取失败");
            }
        })
    }
    function getClasses(subjectId) {
        //获取到所有的班级
        $.ajax({
            url: "${pageContext.request.contextPath}/subject/getClassList",
            type: 'get',
            data: {"subjectId": subjectId},//传递课程id
            dataType: 'json',
            success: function (result) {
                if (result.code == 0) {
                    showClassList(result.classList);
                }
            },
            error: function (err) {
                alert(err.message);
            }
        })
    }
    //获取到班级列表
    function showClassList(classList) {
        var html = '';
        for (var i = 0; i < classList.length; i++) {
            var item = classList[i];
            html += "<li><h4>";
            html+="<a href=#>"
            html += item.name ;
            html += "</a>    ";
            html+= item.headmaster;
            html += "</h4></li>";
        }
        $("#classes").html(html);
    }
</script>
</body>
</html>


